      TITLE   "single scheme- Hybrid Discrete Notching SDF1.0 Decoder Series6 w/HORN SELECTIONS"
----------------------------------------------------------------------------
   <ROAD> <PRIME MOVER> <CLASS> <MODEL> <TYPE> 	7/1/19
 	DN6c3x6d10v60_<MODEL>.SPJ Version 6.0
PROJECT_ID:	00	<ENTER ID HERE and in ASM>
ASM:	DN6c3x6d10v60_<MODEL>.asm	
SDF:		DN6c3x6d10v60_<MODEL>.SDF
BASE CODE:	DN6c3x6d10v60 -- Hybrid Discrete Notching,  3 Channel, SDF Ver 1.0
MEMORY:	512k bytes required
SOUND SET:	 <PRIME MOVER>  <CLASS> <MODEL> <TYPE> 44KHz
CHANNELS:	3
SERIES:	6
Author:  John McMasters
	Custom sound scheme. July, 2019 NOT for resale.
	(C) Copyright John McMasters 2019, used with permission.
CV60=0=DIESEL5 SOUND SCHEME   
reuse base code for each scheme:
DO NOT use hyphens in replacement arguments (above) or file names. Use underscores instead.

Specifications:
<replace here from ASM and then replace semi-colons with blank>


PRIME MOVER CONSTANTS: <replace with specific motor>
Idle speed - 315 rotations per minute (rpm)
MIN_RPM		EQU	315	
567 series has a maximum engine speed 800
MAX_RPM		EQU	800






---------------------------------------------------
	INTRODUCTION
 ----------------------------------------------------------------------------
  This is the Sound Definition Language (SDL) file for a project that can be
  used for a 8bit 512k sound decoder for a typical diesel locomotive. 

Features:
	Bells -- bells may be chained to play for simulation of rope pulls
	Low Idle -- Optional, Idle run is trimmed, also optional ALCO stumble
	Fans -- High and low alternate random
	Auto Vary Notch	--	motor sounds vary: idle blip, load sensing
	Variable Dynamics -- F5 will notch up to run 4 and play dynamic fan, speed varied by throttle setting
	Horns/Whistles -- Selectable, playable, signal toots
		Grade crossing horn plays rear horn sounds going backwards
		Analog Playable Horn/whistle/horn (horn runs that had the transition to higher pressure/ very loud modes)
	Brake Interlock	-- F3 will lock motor at standstill until released
		Integrated automatic braking sounds on F9
		All brakes are controlled by F3 (formerly F9) so that servo motor decoder braking could be syncronized
		EStop  on F8 On with F3 on shut-down	(disables motor movement until OFF)
	Manual Notch Run mode 
	with F6+ and F7- as well as automatic...)
	Hybrid Discrete Notching

 ----------------------------------------------------------------------------
	DESIGN NOTES 
 ----------------------------------------------------------------------------
SET -- SCV_LOAD_MIN,4,0	Range Volume Scale to a value between 1-5
						Drifting volume will diminish to this level.

COLD STARTUP FUNCTIONS:
	Play Startup Sounds: F3 + F4 and then release F4...
	The following Function Keys will SKIP STARTUP Sounds and begin with RUN sounds:
	F8, F0, F1, F2, F6, F4	


----------------------------------
     FUNCTION KEYS DEFINED:   
----------------------------------
(A) Function Key Usage: 
F0- Lights  [disables start-up sounds when on during initialization]
F1- Bell 	Bell5 is 3part (Bells1-4 may be chained)
F2- Horn/Whistle	CV150 selects Horn/Whistle type	(Playable when bit7 of CV150 is on)	-- Shorter sounds when F9 ON
F3- Use for start-up -- F3 on + F4 on to cold start (release F4 to end fuel prime)
F3- BRAKE TO STOP -- Usage:
			Independent Brake/Train Brake	[Leave F9 OFF for auto brakes] 
			[F3 on will enable servo motor stop.]
			Toggle OFF plays directional toots WHEN F9 ON
		1) Slow servo motor to stop using CV3,CV4 momentum values (where
			larger value (50) takes longer to slow/accelerate)
		2) Lock motor at standstill to simulate engine brake set. Servo
			will not resume until F3 is toggled off.
		3) While brake is set toggle F9 on to begin uncoupling. F9 will play 
			lift ring noise in preparation for disconnect. 
		4) Releasing the brake and advancing the throttle will play coupler
			disconnect when F9 is already on.
		Brake rate is determined by BEMF and CV3,4
	 	Auto Coupler coupler clank and BRAKE if F9 is ON,  is dir chng and last PK spd below e.g. CV151
			[Auto-coupler/brake set by  CV151 max spd] F9 ON for un-coupler
			[Leave F9 on for auto coupler]	
 	F3 OFF -- Release Brake [not F3 Apply else Release] 
F4- Reserved for light function (turn on rear light, etc.) / Cold start when on
		Will play shorter horn on F2
F5- Dynamic brake fans when moving		
		Otherwise: Handbrake sequence	[Handbrake while stopped] 
		Handbrake loop will PLAY until F5 Off
		Must be toggled off after start-up (F3+F4) or else handbrake will 
		keep unit from moving...
F6- Notch UP 	Leave on for increased load
		Leave F6 OFF to use run trim option: [will increment 
		notches on acceleration events 
		F7 will decrement run trim.
F7- Notch down	-- Leave ON for decreased load
		Toggle F7 ON Is notch down for EVENT, 
			integrate -VE in SPEED_DELTA
		F7 will decrement run trim (i.e., use to select lower trim value).
		Steam=Wheel-slip, when CV155 is not 0 and F9 ON
F8-  Mute control/Start-up	[F8 to OFF is muted to CV volume, 
		F8 ON, set REG volume]
		On the initial push of F8 the sound comes up. 
		A secondary push raises the sound again to normal levels.
		EStop  on F8 On with F3 on shut-down	(disables motor movement until OFF)
F9- Coupler / Coupler disconnect	[Auto-coupler/brake set by  CV151 max spd]
		Lift ring and connect plays with F9 when F9 is ON
		Long train consist brake sounds with F20 ON
		Steam Wheel Slip on start-up (Enable) /auto coupler
		(disables toots on F9) [Leave on for auto toots]
F10- Grade crossing Air-horn/Whistle sequence	[Bell stays on until F10 off]
F11- Allow SUSTAIN horn on F2
F12- Wheel Squeal (continuous when moving) [Disables bell on F1]
F13- Compressor/Air features disable   / Coal Fill  
		F13 ON =disable AIR sound/FEATURES, trig BLOWOFF/HNDL_FAST_DRIER1 then compressor ONE time
		[F13 OFF enables pop-off, DRIER and compressor]
F14- EStop when moving and shut-down	(disables motor movement until OFF)
F15- Sanding Valve / Water Fill
F16- Cab Chatter
F17- User assigned sound
F18- High Fan / Steam=Greaser
F19- Enables AUX generator (Disables Auto Notch Vary)
F20- Short Air Let Off	
F21- Straight to manual notch1
F22- Straight to manual notch2
F23- Straight to manual notch3
F24- Straight to manual notch4
F25- Straight to manual notch5
F26- Straight to manual notch6
F27- Straight to manual notch7
F28- Straight to manual notch8

	==================================  
Note: Many sound levels have been reduced so that horn/whistle is much louder.
	Global Gain in the project has been maximized to help. Some low volume 
	levels may need increases on your model.

	==================================  
(B) Sound FX defined CV's: 	[decoder CV8=8  reset value in brackets]
CV3	  Momentum acceleration rate, 0-63, 63=max, (uses after braking to start) [50]
CV4	  Momentum deceleration rate, 0-63, 63=max, (uses for braking to stop) [40]
CV7 Version ID 51=Older decoders, 16=Newer SFX2 decoders
SCV_RESET (CV8)  Reset Decoder values to factory =129=Digitrax
SCV_19  Advanced Consist [0]
SCV_21  Advanced Consist F0-F8 [248] 
SCV_22  Advanced Consist F9-F12 [52] 
SCV_54 (CV54) 	 Road or Switching Mode [64,0,1]
SCV_57  BEMF Consist + Advanced Consist, 0-15 / 0-15, 15=max (14,14 15,15) [238]
CV58  Master Volume, 0-15, 0= max, (F8 used for Mute) [11] 
 	DEFAULT_GLBL_GAIN	 	Predefined as 0xC0
CV60  Scheme select CV, 0=Diesel 1=Steam	[0]
SCV_USER_SDF_SUB_ID		CV105 	[xx] Sub ID is SUB id or project version
SCV_USER_SDF_FIX_ID		CV106 	[xx] FIX ID is change id or project release
CV121 Sound Project SDF Version 0,4,8,16	Read Only Value
CV122 Product TYpe, 12 = Digitrax SFX sound decoder 	Read Only Value
CV123 Hardware Version, 64= SDXH166 type decoder	Read Only Value. May vary based on SFX2 decoder loaded into.
				CV126= DL config byte
SNDCV_CONFIGA	CV129= config byte
SNDCV_CONFIGB	CV130= config byte
SCV_DCONFIG	CV131= diesel config
CV132 Engine Notch rate		64-192	[164]
CV133 Steam Chuff/CAM config, 128=>EXT cam, 1-127=>DRIVER dia in inches [60]
CV134 Steam gear ratio trim, 32=100% ratio,	[41]
CV135 vol level when MUTE action is triggered, e.g. F8=ON	[30]
SCV_MAIN_PITCH	CV136
SCV_137		CV137
SCV_138		SCV138= 
CV139 Set to trigger distance event	0-64	[30]
User configurable SoundCV's
SCV_FREEFORM		SCV_140+, here the SCV's are SDF defined:
CV140 PRIME mover Diesel/chuff-exhaust vol 0-64	[50]
CV141 Bell Volume							0-64	[36]
CV142 WHISTLE/HORN vol						0-64	[42]
CV143 DRYER AIR feature volume, drier, compressor, brake release Air sounds Volume 0-64 [49]
CV144 Engine brake volume 0-64	[55]
CV145 Miscellaneous volume 0-64	[51] 
CV146 Delay (24mS counts) between Bells 1-100	[01] 
CV147 Time between Drier cycles Users normally reset drier rate to 10 or more[27] 
CV148 Time between Air-pump/Compressor cycles	[30] 
CV149 Air-pump/Compressor run time				[52] 
CV150 Horn/Whistle Selector,0=std ,  1/7 =Alternate, +128 for Playable volume [0]
			HORN SELECTED CV150:
						Decimal	HEX			Bit
											7654 3210
				1		0		0x00		0000 0000
				2		1		0x01		0000 0001
				3		2		0x02		0000 0010
				4		3		0x03		0000 0011
				5		4		0x04		0000 0100
				6		5		0x05		0000 0101
				7		6		0x06		0000 0110
				PLAYABLE:
				1		128		0x80		1000 0000
				2		129		0x81		1000 0001
				3		130		0x82		1000 0010
				4		131		0x83		1000 0011
				5		132		0x84		1000 0100
						Decimal	HEX			Bit
CV151 speed limit FOR AUTOMATIC COUPLER/BRAKE on DIR chng. about 1/2MPH per unit
CV152 defines USER code for this SDF
CV153 is SUB id
CV154 Delay brake apply 1-100/ speed at which brake sounds begin to play [12] 
CV155 Notching mode 0=AUTO, 1=SEMIAUTO, 2=MANUAL NOTCHES	[01] /STEAM Slip Mode: 0=AUTO, 1=SEMIAUTO, 2=MANUAL 						[01]
CV156 delay for HORN start in 27mS VALUES
CV157 is FOR bell selection 
	BELL SELECTED CV157:
						Decimal	HEX			Bit
											7654 3210
				1		0		0x00		0000 0000
				2		1		0x01		0000 0001
				3		2		0x02		0000 0010
				4		3		0x03		0000 0011
				5		4		0x04		0000 0100
CV158 	DIGITRAX RESERVED
CV159 Min value to tune minimum volume 5-8 [7]
CV160  VARIANT id or project version	0-254	[000]
	Extended Custom CV values: These are not easily modified by the user as yet (Use SoundLoader to manually override)
CV161	Start slips under this speed 	0-32	[4]
CV162	Water Injector Volume			0-64	[25]
CV163	Safety Run Time/ how often to check boiler pressure		0-64	[32]
CV164  Level in the guage/ Water Pump Cycle Time, percent full	0-64	 [19]
CV165	add fuel to firebox at 150lbs/ Stoker/oil pump run time	0-254	[20]	
CV166	Cut-off Speed for wheel slip chuffs				4-9	[9]
CV167 	Cut-off Speed for Auto Cyl. blow down			0-64	[7]
CV168  Stoker Volume									0-64	[32]
CV169	Cut-off Speed for high speed chuffs				40-99	[48]	
CV170	Cut-off Speed LOW	skips brake sounds			4-39	[12]
CV171	AUX GEN VOLUME									0-64	[40]
CV172	FAN MOTOR VOLUME								0-64	[30]
CV173  STEAM blow-down volume							0-64	[50]
CV174 	AIR feature volume, drier Air sounds Volume 	0-64	[49] 
CV175	Air compressor volume							0-64	[40]
CV176	ALT HORN/WHISTLE volume							0-64	[60]			
CV177	Coupler Slack Volume							0-64	[31]
CV178	Steam Boiler Volume								0-64	[40]
CV179  Dynamic brake / Dynamo volume 					0-64	[55]
CV180	Steam Blow-down/Safety vol						0-64	[59]
CV181	Power Reverser volume							0-64	[40]
CV182 	brake release Air sounds Volume 				0-64 	[32] 
CV183	Water fill/Coal fill Volume						0-64	[54]
CV184	Steam cock blow down threshold 					1-64	[24]
CV185 bit values to disable features1:					0-128	[0]
		bit0 disable  HEP diesel =0 AUX GEN	=1			=1		
		bit1 disable hard automatic braking 			=2
		bit2 disable start-up sounds					=4
		bit3 disable Fans								=8
		bit4 disable toots on direction change			=16
		bit5 disable grade crossing random play 		=32
		bit6 disable bell								=64
		bit7 fuel prime once for Gen1 diesels OR multiple start warning bells Gen2	=128
CV186 bit values to disable additional features2 		0-128	[0]
		bit0 enable Diesel Low Idle=1 Disabled=0	=1=Enabled
		bit1 disable Chain bells 1-4 					=2
		bit2 disable STOKER change to SHOVEL			=4
		bit3 disable AUTO VARY NOTCH					=8
		bit4 disable Shaft Driven Compressor 			=16
		bit5 disable ALCO Idle Stumble=32 Disable=0		=32
		bit6 disable Auto REAR horn signals: 0=Off, 64=On	=64
		bit7 disable Dual Prime Movers		0=Off 128=Dual On
CV187 bit values to disable additional features3 	0-128 [0]
		bit0 disable Short Opt Horn/whistle	Enabled=0, =1=disabled
		bit1 disable DEMO ALL HornS/whistles Enabled=on=0, =2=disabled
		bit2 disable Bell on Idle Exit				=4
		bit3 disable Motor Lock on F3				=8
		bit4 disable start-up Muted					=16
		bit5 disable Dynamic BRAKES					=32
		bit6 disable 								=64
		bit7 disable Auto Wheel Slip				=128
CV187 bit values to disable additional features3 	0-128 [0]
		bit0 disable Short Opt Horn/whistle	 Enabled=0,   =1=disabled
		bit1 disable DEMO ALL HornS/whistles Enabled=on=0,=2=disabled
		bit2 disable Bell on Idle Exit				=4
		bit3 disable Motor Lock on F3				=8
		bit4 disable start-up Muted					=16
		bit5 disable Dynamic BRAKES					=32
		bit6 disable 								=64
		bit7 disable Auto Wheel Slip				=128
CV188 bit values to disable additional features4	0-128 [0]
		bit0 disable 1								=1
		bit0 disable 2								=2
		bit2 disable 3								=4
		bit3 disable 4								=8
		bit4 disable 5								=16
		bit5 disable 6								=32
		bit6 disable 7								=64
		bit7 disable 8								=128
CV189 Water Alarm Volume			0-64	[45]
CV190 Stoker/oil pump run time		0-254	[20]	
CV191 Drift Volume					0-64	[20]										1-100	[30]




CV192 Cut-off Speed for LONG HORN	4-9	[9]
CV193 Sound Project TYPE
Possible Values are :
	:			Decimal	HEX			Bit
	:								7654 3210
	:	1		0		0x00		0000 0000		Steam Coal
	:	2		1		0x01		0000 0001		Steam Oil
	:	3		2		0x02		0000 0010		Steam Coal  Articulated
	:	4		3		0x03		0000 0011		Steam Oil Articulated	
	:	5		4		0x04		0000 0100		Steam Geared	
	:	9		8		0x08		0000 1000		Steam non-fired	
	:	81		80		0x50		0101 0000		Gas Carbody / Doodlebug
	:	127		128		0x80		1000 0000		Diesel
	:	145		144		0x90		1001 0000		Diesel Carbody	
	:	193		192		0xC0		1100 0000		Diesel Dual Motor (startup Linked)	
	:	225		224		0xE0		1110 0000		Diesel Dual Motor (startup un-Linked)
	:	241		240		0xF0		1111 0000		Diesel Boxcab
	:	137		136		0x88		1000 1000		Traction
CV194 Sound Project Memory Required [1=512kb, 2=1024kb, 3=2mb, 4=4mb, 8=8mb, 16=16mb].
CV195 Sound Project JMRI Definition(0-255)
CV200 RESERVED
CV201 RESERVED
CV202 RESERVED
CV203 Decoder Memory Available (read only) [1=512kb, 2=1024kb, 3=2mb, 4=4mb, 8=8mb, 16=16mb].

	
V5.01 Fix: AND, OR BIT FLIP FLOPS AND COMPARES: 7/18/17
		  MASK_COMPARE 	USER_INTLK_BITS,IMMED_DATA,CYLCOCK_MASK4,~CYLCOCK_MASK4,SKIP_SAME	TEST BIT4 FOR TRUE WHEN SET=ON / SKIP_LESSSKIP_GRTR  		
		  LOAD_MODIFIER	MTYPE_WORK_IMMED,FMATH_OR+USER_INTLK_BITS,CYLCOCK_MASK4,MERGE_ALL_MASK	OR=SETtheBit bit4	OPEN CYLCOCK INTERLOCK
		  LOAD_MODIFIER	MTYPE_WORK_IMMED,FMATH_AND+USER_INTLK_BITS,~CYLCOCK_MASK4,MERGE_ALL_MASK	AND=FLIPtheBit bit4	OPEN CYLCOCK INTERLOCK
v5.02 Fix: START_MASK1 7/21/17

v5.3 3/20/18 add more definition CVs 199-203, change QUILL back to SUSTAIN2
(C) General Notes
Project sounds are amplified to the limit. When lower power is supplied while on
a test bench using SoundLoader louder sounds will exceed the speaker output range (see formula). 
Running at full power on the main track in real use, sound levels may be increase significantly.
This project was tested at Master Volume CV58=11. Horn Volume was tested at CV142>50. 
Prime mover Volume was tested at CV140>50. However,
Default Master Volume CV58=9 THIS SHOULD BE 7 OR LESS FOR TESTING WITH SOUNDLOADER - JohnM 3/23/17

Set CV60 to 0 for this project.
The SDXH166 16bit series2 SFX decoders allow downloading of 8,12 and 16 bit wave files and up to 4 
voices defined in the SDF project definition embedded in SPJ file. 

For CV155=01 ["Semi_automatic Notching"] when CV60=0 to 5 (Diesel),  the Prime mover lowest Notch setting is set by
the current throttle speed setting. F6 (ON) can increase the Notch and F7 (ON) will decrease the Prime mover
to the minimum notch set by current throttle setting.

Cam triggered exhaust sounds (e.g. steam) are only configured for 8 or 16 bit wav file downloads.
RS1 sound courtesy of R  Schramm, some Bells/Horns courtesy Matt Donnelly, some prime movers by C Brown and P Knowles 
Many sounds (EMD 645E NT, P42) are derived courtesy of jointedrail com, used by permission  Additional sounds courtesy John McMasters
Other contributors may include Mike Cyr/Justin Cordell and other Digitrax contributors and employees and contractors 

Balance of sounds recorded by Digitrax Inc  All sounds used by permission 


